package com.panshi.controller;

import com.panshi.service.QuestionAuditService;
import com.panshi.service.ReplyAuditService;
import com.panshi.vo.qa.QuestionAudit;
import com.panshi.vo.qa.ReplyAudit;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 问题审核
 * @author Administrator
 *
 */
@Api("rabbitmq业务接口")
@Configuration
@RestController
@RequestMapping("/rabbitmq")
public class Controller {
	@Autowired
    RabbitTemplate rabbitTemplate;
	@Autowired
    MessageConverter messageConverter;
	//问题
	@Autowired
	QuestionAuditService questionAuditService;
	//回答
	@Autowired
	ReplyAuditService replyAuditService;

	@GetMapping("/questionAudit/send")
	@ApiOperation("问题审核完成后通知用户")
	@ApiImplicitParam(name = "questionAudit",value = "问题审核类")
	public boolean sendQuestionAudit(@RequestParam QuestionAudit questionAudit) {

		//发送一个发布者与订阅模式，或者扇形交换器消息
		questionAuditService.send(questionAudit);
		 
		return true;
	}

	@GetMapping("/replyAudit/send")
	@ApiOperation("回答审核完成后通知用户")
	@ApiImplicitParam(name = "questionAudit",value = "回答审核类")
	public boolean sendReplyAudit(@RequestParam ReplyAudit replyAudit) {

		//发送一个发布者与订阅模式，或者扇形交换器消息
		replyAuditService.send(replyAudit);

		return true;
	}
	
}
